package com.wskj.insuranceweb.reporter.service;

import com.wskj.insuranceweb.reporter.mapper.AcceptMapper;
import com.wskj.insuranceweb.reporter.pojo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class AcceptServiceImpl implements  AcceptService {
    @Autowired
    private AcceptMapper mapper;


    @Override
    public List<Accept> showList(String report, String customernumber) {
        return mapper.showList(report,customernumber);
    }

    @Override
    public void addAccept(Reporter reporter) {

        Accept aa=new Accept(reporter.getReport(),reporter.getClaimstatus(),reporter.getCustomernumber(),reporter.getReportdate(),"个人",reporter.getEmployeename(),
                "未调查",reporter.getAccidentdate(),"审核");
        System.out.println(aa);
        mapper.addAccept(aa);
    }

    @Override
    public Accept findAcceptById(String id) {
        return mapper.findAcceptById(id);
    }

    @Override
    public void updateById(String id, String name) {
        mapper.updateById(id,name);
    }

    @Override
    public List<Accept> findAccept() {
        return mapper.findAccept();
    }

    @Override
    public void updateInvestigation(String id) {
        mapper.updateInvestigation(id);
    }

    @Override
    public void updateByCust(String customernumber) {
        mapper.updateByCust(customernumber);
    }

    @Override
    public void updateCauseByCust(String cust) {
        mapper.updateCauseByCust(cust);
    }

    @Override
    public void updateCByCust(String cust) {
        mapper.updateCByCust(cust);
    }

    @Override
    public void editpond(String cust) {
        mapper.editpond(cust);
    }

    @Override
    public List<Accept> findAcceptBySuspend() {
        return mapper.findAcceptBySuspend();
    }

    @Override
    public void returnPool(String cust) {
        mapper.returnPool(cust);
    }

    @Override
    public Accept getAccept(String cust) {
        return mapper.getAccept(cust);
    }

    @Override
    public void deleteAccept(String cust) {
        mapper.deleteAccept(cust);
    }

    @Override
    public Claim getClaim(String claimstatus, String findings, String customernumber) {
        Claim claim = new Claim();
        claim.setCustomernumber(customernumber);
        if (claimstatus.equals("身故")&& findings.contains("航空")){
            claim.setMoney(3000000);
            claim.setClaim("身故");
            claim.setAviation("是");
        }
        if (claimstatus.equals("身故")&&!findings.contains("航空")){
            claim.setMoney(1000000);
            claim.setClaim("身故");
            claim.setAviation("否");
        }
        if (claimstatus.equals("高残")){
            claim.setClaim("高残");
            if(findings.contains("航空")){
                claim.setMoney(750000);
                claim.setAviation("是");
            }else{
                claim.setMoney(250000);
                claim.setAviation("否");
            }
        }
        if (claimstatus.equals("重大疾病")){
            claim.setClaim("重大疾病");
            claim.setMoney(150000);
            claim.setAviation("否");
        }
        if (claimstatus.contains("烧伤")){
            claim.setClaim("烧伤、致残、骨折");
            claim.setMoney(50000);
            claim.setAviation("否");
        }
        if (claimstatus.contains("医疗事故")){
            claim.setClaim("医疗事故");
            claim.setMoney(200000);
            claim.setAviation("否");
        }
        if(claimstatus.equals("特种疾病")){
            claim.setClaim("特种疾病");
            claim.setMoney(50000);
            claim.setAviation("否");
        }
        mapper.insertClaim(claim);
        return mapper.findClaim(customernumber);
    }

    @Override
    public Claim findClaim(String cust) {
        return mapper.findClaim(cust);
    }

    @Override
    public Backuparea findBackuparea(String reporter) {
        return mapper.findBackuparea(reporter);
    }

    @Override
    public void update(Backuparea b) {
        mapper.update(b);
    }

    @Override
    public void addModifycause(Modifycause modifycause) {
        mapper.addModifycause(modifycause);
    }

    @Override
    public List<Modifycause> findModifycause(String reporter) {
        return mapper.findModifycause(reporter);
    }

    @Override
    public void editconcl(String report) {
        mapper.editconcl(report);
    }

    @Override
    public void addConclusion(Conclusion conclusion) {
        mapper.addConclusion(conclusion);
    }

    @Override
    public void editclaim(String report) {
        mapper.editclaim(report);
    }

    @Override
    public List<Accept> AcceptList(String report, String customernumber) {
        return mapper.AcceptList(report,customernumber);
    }

    @Override
    public Conclusion getConclusion(String report) {
        return mapper.getConclusion(report);
    }

    @Override
    public void updateClaim(String report) {
        mapper.updateClaim(report);
    }

    @Override
    public void addExamine(Examine examine) {
        mapper.addExamine(examine);
    }


}
